package com.zxpan.restaurant.persist.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.zxpan.restaurant.db.model.User;
import com.zxpan.restaurant.persist.dao.UserDao;


public class UserDaoImpl extends DaoBase<User> implements UserDao {

    private static final String PREFIX = "user";

    public UserDaoImpl() {
    	super.setClazz(User.class);
    	super.setPrefix(PREFIX);
    }

	@Override
	public User getUser(String id, String password) {
		Map<String,String> param = new HashMap<String, String>();
		param.put("id", id);
		param.put("password", password);
		User[] userArray = super.select(param);
		
		if(userArray != null && userArray.length != 0) {
			return userArray[0];
		}
		return null;
	}

	@Override
	public int addUser(User user) {
		return super.add(user);
	}
	
}
